#version 300 es
precision mediump float;
precision highp int;

layout(std140) uniform fs_ub
{
    highp vec3 u_gradientColor1;
    highp vec3 u_gradientColor2;
    highp float u_gradientOffset;
    highp float u_gradientAngle;
    highp vec4 u_textColor;
    int u_isShadowPass;
} _35;

uniform mediump sampler2D u_tex0;

in highp vec2 v_texCoord1;
layout(location = 0) out highp vec4 FragColor;
in highp vec4 v_color;
in highp vec2 v_texCoord;

highp mat2 rotate(highp float angle)
{
    return mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle)));
}

void main()
{
    if (_35.u_isShadowPass == 0)
    {
        highp vec2 uv1 = v_texCoord1;
        uv1 -= vec2(0.5);
        highp float param = _35.u_gradientAngle;
        highp float lerpAlpha = vec2(rotate(param) * uv1).y;
        uv1 += vec2(0.5);
        highp vec3 gradientColor = mix(_35.u_gradientColor1, _35.u_gradientColor2, vec3(lerpAlpha - _35.u_gradientOffset));
        FragColor = v_color * vec4(gradientColor, _35.u_textColor.w * texture(u_tex0, v_texCoord).x);
    }
    else
    {
        if (_35.u_isShadowPass == 1)
        {
            FragColor = v_color * vec4(_35.u_textColor.xyz, _35.u_textColor.w * texture(u_tex0, v_texCoord).x);
        }
    }
}

